package servlet;

import Hbase.IndividualStudent;
import pojo.ST;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;

@WebServlet("/AlterServlet")
public class AlterServlet extends HttpServlet {

    public void init(HttpServletRequest req, HttpServletResponse resp) throws UnsupportedEncodingException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        resp.setCharacterEncoding("utf-8");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException,ServletException {
        System.out.println("!!!!!!!!!!");
        init(req,resp);
        String ID=req.getParameter("id");
        IndividualStudent individualStudent = new IndividualStudent();
        List<ST> display = individualStudent.Individual(ID);
        resp.setContentType("text/html;charset=utf-8");

        HttpSession session = req.getSession();

        req.setAttribute("obj_data1",display);

    req.getRequestDispatcher("/Alter2.jsp").forward(req, resp);

    }


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }

}
